[#ftl]
[@define "agile.MetadataSpecEditorPane" "MetadataEditorPane" "MetadataEditorPane=agile.MetadataEditorPane"]
  	category:""
	,title:"Spec"
	[#assign templateString][#compress]
	<div style="width:100%">
		<div style="margin:3px 0px">
		<span>Requirements</span>		
		<div data-dojo-type='dijit/form/SimpleTextarea' data-dojo-props='"style":"width:96%;height:86%",name:"requirement"' class="editor"></div>
		</div>
		<div style="margin:3px 0px">
		<span>Benefits</span>		
		<div data-dojo-type='dijit/form/SimpleTextarea' data-dojo-props='"style":"width:96%;height:86%",name:"benefit"' class="editor"></div>
		</div>
		<div style="margin:3px 0px">
		<span>Efforts</span>		
		<div data-dojo-type='dijit/form/SimpleTextarea' data-dojo-props='"style":"width:96%;height:86%",name:"effort"' class="editor"></div>
		</div>
		<div style="margin:3px 0px">
		<span>Risks</span>		
		<div data-dojo-type='dijit/form/SimpleTextarea' data-dojo-props='"style":"width:96%;height:86%",name:"risk"' class="editor"></div>
		</div>
		<span style="margin:3px 0px">Priotity</span>		
		<div data-dojo-type='dijit/form/FilteringSelect' class="editor" data-dojo-props='name:"priotity","options":[{"label":"Critical","value":"Critical"},{"label":"High","value":"High"},{"label":"Medium","value":"Medium"},{"label":"Low","value":"Low"}]'></div>
		<span style="margin:3px 0px">Status</span>		
		<div data-dojo-type='dijit/form/FilteringSelect' class="editor" data-dojo-props='name:"status","options":[{"label":"New","value":"New"},{"label":"WIP","value":"WIP"},{"label":"Developed","value":"Developed"},{"label":"Released","value":"Released"}]'></div>
		
	</div>[/#compress]
	[/#assign]
	,templateString:"${templateString?js_string}"	
	,init:function(){
		this.inherited(arguments);
		
		query(".editor",this.domNode).forEach(lang.hitch(this,function(node){
			var editor = registry.byNode(node)
			this.editorWidgets[editor.name] = editor;
			editor.watch("value",lang.hitch(this,function(name,old,value){				
				if(this._notWatch){
					//console.log(editor.name,arguments)	
				}else{
					if(this.currentWidget){
						this.currentWidget.metadata("parameters.spec." + editor.name,value);
					}
				}
			}));
		}));		
	}
	,onWidgetSelected:function(widget){	
		this.currentWidget = widget;
		this._notWatch = true;
		if(widget != null){
			var spec = widget.metadata("parameters.spec");
	 		for(var name in this.editorWidgets){
	 			this.editorWidgets[name].set("value",(spec && spec[name])?spec[name]:"");
	 		}
	 	}else{
	 		for(var name in this.editorWidgets){
	 			this.editorWidgets[name].set("value","");
	 		}
		}		
		this._notWatch = false;
	}
[/@] 